<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:U('Admin/LiveChannel/index')}">频道列表</a></li>
			<if condition="$admin_id eq 1">
				<li><a href="{:U('Admin/LiveChannel/add')}">添加频道</a></li>
			</if>
		</ul>
		<form class="well form-search" id="query_form" method="post" action="{:U('Admin/LiveChannel/index')}">
			名称： 
			<input type="text" name="name" style="width: 120px;" value="{$formParam.name}" placeholder="频道名称...">
			状态： 
			<select class="select_2" name="status" style="width: 90px;">
				<option value='-1'>全部</option>
				<option value='1' <if condition="$formParam.status eq 1"> selected </if>>启用</option>
				<option value='0' <if condition="$formParam.status eq 0"> selected </if>>停用</option>
			</select>
			<input type="button" name="query_form_btn" id="queryBtn" data-action="{:U('Admin/LiveChannel/index')}" class="btn btn-primary" value="查询" />
		</form>
		<form class="js-ajax-form" action="" method="post">
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<th>频道名称</th>
					<th>负责人姓名</th>
					<th>负责人电话</th>
					<th>设备类型</th>
					<th>推流业务员</th>
					<th>频道描述</th>
					<th>采集端频道</th>
					<th>频道状态</th>
					<th>直播状态</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<php>
					 $status = array("0"=>'停用',"1"=>'启用');
					 $type = array("1"=>'VR',"2"=>'普通',"3"=>'手机');
					 $channel_type = array("0"=>'否','1'=>'是');
				</php>
				<foreach name="data" item="vo">
				<tr>
					<td>{$vo.channel_name}</td>
					<td>{$vo.manager}</td>
					<td>{$vo.manager_phone}</td>
					<td>{$type[$vo['device_type']]}</td>
					<td>
					  {$vo.push_operator}
					  <if condition="$vo.device_type eq 3">
					      <a style="float:right;" href='javascript:void(1);' onclick='edit_operator({$vo["channel_id"]})' >修改</a>
					  </if>
					</td>
					<td>{$vo.channel_describe}</td>
					<td>{$channel_type[$vo['type']]}</td>
					<td>{$status[$vo['status']]}</td>
					<td><if condition="$vo.push_status eq 1">
					      <span style="color:#00ff00;font-weight:bold;">正在输入</span>
					    </if>
					    <if condition="$vo.push_status eq 0">
					      <span style="color:#ff0000;font-weight:bold;">无输入流</span>
					    </if>
					</td>
					<td>
						<if condition="$admin_id eq 1">
							<a href='{:U("Admin/LiveChannel/edit",array("channelId"=>$vo["channel_id"]))}'>编辑</a>
						</if>
						<if condition="$vo.status eq 1 and $admin_id eq 1">

							<a href='{:U("Admin/LiveChannel/disable",array("channelId"=>$vo["channel_id"],"txyChannelId"=>$vo["txy_channel_id"]))}' class="js-ajax-dialog-btn">停用</a>
						</if>
						<if condition="$vo.status eq 0 and $admin_id eq 1">
							<a href='{:U("Admin/LiveChannel/enable",array("channelId"=>$vo["channel_id"],"txyChannelId"=>$vo["txy_channel_id"]))}' class="js-ajax-dialog-btn">启用</a>
						</if>
						<a  href='{:U("Admin/LiveChannel/view_live",array("channel_id"=>$vo["txy_channel_id"]))}'>预览</a>
						<a class="link_url" data-clipboard-text="{$vo.push_url}" title="{$vo.push_url}" href="javascript:;">复制推流地址</a>
					</td>
				</tr>
				</foreach>
			</tbody>
		</table>
		</form>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/ueditor/third-party/zeroclipboard/ZeroClipboard.min.js"></script>
	<script src="__PUBLIC__/js/layer/layer.js"></script>
	<script>
	$(document).ready(function(){
		$('input[name="query_form_btn"]').click(function(){
			 $('#query_form').attr('action', $(this).attr('data-action'));
			 $('#query_form').submit();
		});
		var clip = new ZeroClipboard($("td .link_url"));
		clip.on("aftercopy", function(e){
		    alert('复制成功！');
		});
	});
	function edit_operator(channel_id){
		  layer.open({
	  	    type: 2,
	  	    //skin: 'layui-layer-lan',
	  	    title: '修改推流业务员',
	  	    fix: false,
	  	    shadeClose: true,
	  	    maxmin: true,
	  	    area: ['800px', '500px'],
	  	    content: "<?php echo U('Admin/LiveChannel/edit_operator')?>"+'&channel_id='+channel_id,
	  	    end: function(){
	  	    	location.reload();
	  	    }
	  	  });
	 }
	function view_live(channel_id){
		  layer.open({
			  type: 2,
		  	    //skin: 'layui-layer-lan',
		  	    title: '直播预览',
		  	    fix: false,
		  	    shadeClose: false,
		  	    maxmin: true,
		  	    area: ['1024px', '500px'],
	  	    content: "<?php echo U('Admin/LiveChannel/view_live')?>"+'&channel_id='+channel_id,
	  	    end: function(){
	  	    	location.reload();
	  	    }
	  	  });
	 }
	</script>
</body>
</html>